// 引入

import commom from "../../pages/utils/common.js"

Page({

  /**
   * 页面的初始数据
   */
  data: {
    longitude:"",
    latitude:""

    
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    commom.getNewname("song")
    
  },

  
  onReady: function () {
    console.log(11111111111)
    this.mapCtx = wx.createMapContext('myMap')
    // this.getCenterLocation()
    this.getLocation()
    
  },
  getLocation(){
    var that = this;
    wx.getLocation({
      type: 'gcj02', //返回可以用于wx.openLocation的经纬度
      success: function(res) {
        console.log(res.longitude)
        console.log(res.latitude)
        that.setData({
          longitude: res.longitude,
          latitude: res.latitude
        })
      },
    })
  },
  getCenterLocation: function () {
    var that = this;
    this.mapCtx.getCenterLocation({
      success: function (res) {
        that.setData({
          longitude: res.longitude,
          latitude: res.latitude
        })
      }
    })
  },

  
 
})